package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	UserName string `gorm:"type:varchar(30);not null;comment:用户名"`
	Sex      string `gorm:"type:varchar(20);not null;comment:用户性别"`
	Age      int    `gorm:"type:int(11);not null;comment:用户年龄"`
	Address  string `gorm:"type:varchar(50);not null;comment:用户地址"`
	Status   int    `gorm:"type:int(30);not null;default:1;comment:0冻结 1正常"`
}

func (u *User) List() (userList []*User, err error) {
	err = DB.Debug().Where("status = ?", u.Status).Find(&userList).Error
	return
}
